# 设置CMake的最小版本
cmake_minimum_required(VERSION 3.15)

# 项目名称
#   项目可以包含多个目标(target)
#   target: 可执行程序, 静态库, 动态库
project(CloudDisk)

# 指定C++的版本: -std=c++17
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 设置可执行程序生成的路径
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ../)

# 生成的可执行程序
add_executable(server
    CloudiskServer.cpp
    signup.pb.cpp
    signin.pb.cpp
    ServerUtil.cpp
    MqUtil.cpp
    CryptoUtil.cpp
    main.cpp
)

# 设置编译选项
target_compile_options(server PRIVATE
    -fno-rtti
    -g
    -Wall
    -DDEBUG
)

# -lcrypto -lssl -ljwt -lwfrest
target_link_libraries(server PRIVATE 
    curl
    crypto
    pthread
    ssl
    jwt
    workflow
    wfrest
    SimpleAmqpClient 
    srpc
    lz4
    snappy
    protobuf
)

add_executable(consumer
    Consumer.cpp
    MqUtil.cpp
    OssManage.cpp
)

target_compile_options(consumer PRIVATE
    -fno-rtti
    -g
    -Wall
    -DDEBUG
)

target_link_libraries(consumer PRIVATE 
    alibabacloud-oss-cpp-sdk
    curl
    crypto
    pthread
    SimpleAmqpClient
)

add_executable(RegisterServer
    RegisterServer.cpp
    CryptoUtil.cpp
    signup.pb.cpp
)

target_compile_options(RegisterServer PRIVATE
    -DDEBUG
    -g
    -Wall
)

target_link_libraries(RegisterServer PRIVATE 
    srpc
    lz4
    snappy
    protobuf
    workflow
    ssl
    crypto
    pthread
    jwt
    ppconsul
)

add_executable(LoginServer
    LoginServer.cpp
    CryptoUtil.cpp
    signin.pb.cpp
)

target_compile_options(LoginServer PRIVATE
    -DDEBUG
    -g
    -Wall
)

target_link_libraries(LoginServer PRIVATE 
    srpc
    lz4
    snappy
    protobuf
    workflow
    ssl
    crypto
    pthread
    jwt
    ppconsul
)